package com.wlyuan.index.domain.index.valueobj;

import com.wlyuan.core.marker.INamed;
import com.wlyuan.core.marker.NamedMap;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.Map;


@AllArgsConstructor
@Getter
@Deprecated
public enum BillStatus implements INamed<Integer> {
    RECALLED(-2, "已撤回"),
    CLOSED(-1, "已关闭"),
    DRAFT(0, "草稿"),
    RETURNED(30, "已退回");

    private final Integer value;
    private final String name;
    private static final List<BillStatus> CAN_BILL = Arrays.asList(RETURNED, CLOSED, RECALLED);
    private static final Map<Integer, BillStatus> STATUSES = new NamedMap<>(BillStatus.class);

    public static BillStatus valueOf(Integer value) {
        return STATUSES.get(value);
    }

    public boolean canBill() {
        return CAN_BILL.contains(this);
    }
}
